#ifndef __S_MOUSE_MOVING_INFO_H_INCLUDED__
#define __S_MOUSE_MOVING_INFO_H_INCLUDED__
#include "irrTypes.h"
#include "fmath.h"

namespace game
{

	struct SMouseMovingInfo
	{
	public:
		s32 X;
		s32 Y;

		//! Default constructor
		SMouseMovingInfo():	X(0), 
												Y(0),
												LastAngle(-1)
		{
		}

		u32 getAngle()
		{
			u32 result = 0;

			f32 degree = FastAtan2((f32)X, (f32)Y) * (180.0f / PI);

			if (degree > -22.5 && degree < 22.5)
			{
				result = 0;
			}
			else if (degree >= 22.5 && degree <= 67.5)
			{
				result = 315;
			}
			else if (degree > 67.5 && degree < 112.5)
			{
				result = 270;
			}
			else if (degree >= 112.5 && degree <= 157.5)
			{
				result = 225;
			}
			else if (degree <= -22.5 && degree >= -67.5)
			{
				result = 45;
			}
			else if (degree < -67.5 && degree > -112.5)
			{
				result = 90;
			}
			else if (degree <= -112.5 && degree >= -157.5)
			{
				result = 135;
			}
			else if (degree > 157.5 || degree < -157.5)
			{
				result = 180;
			}

			LastAngle = result;

			return result;
		}

		f32 getLength()
		{
			f32 result = 0;

			if (X == 0 && Y == 0)
			{
				result = 0;
			}
			else if (X == 0)
			{
				result = FastAbs((f32)Y);
			}
			else if (Y == 0)
			{
				result = FastAbs((f32)X);
			}
			else
			{
				result = FastSqrt((f32)(X * X + Y * Y));
			}

			return result;
		}

	private:
		//! Not used yet
		s32 LastAngle;
	};
}
#endif